import { Component, OnInit, AfterViewInit, ViewChild } from '@angular/core';
import { RequestService } from '../../../../cores/services/request.service';
import { FullnameService } from '../../services/fullname.service';
import { Location, LocationStrategy, PathLocationStrategy } from '@angular/common';
import { GlobalService, AuthService } from '../../../../cores/services';
import { ActivatedRoute, Router } from '@angular/router';
import { Pagination, ConfirmService, ToastService, Item } from 'ng-tui';
import { ApiData, SearchParams } from '../../../../cores/classes';
import { Goods } from '../../interfaces/fullname.interface';
import { skipWhile, switchMap } from 'rxjs/operators';

@Component({
    // selector: 'app-plate',
    templateUrl: './plate.component.html',
    styleUrls: ['./plate.component.css'],
    providers: [Location, { provide: LocationStrategy, useClass: PathLocationStrategy }],
})
export class PlateComponent implements OnInit {
    @ViewChild('tsTabs') tsTabs: any;
    theads = ['#', '拣货单号', '客户名称', '拣货员', '未拣单品', '已拣单品', '分布货区'];
    billTh = ['#', '订单产品', '发货产品', '发货条码', '计量单位', '未税单位', '含税单位', '含税单价', '发货数量', '发货箱数', '未税金额', '含税金额', '发货仓库', '产品存放区',
        '备注', '体积', '重量', '品牌', '备注'];

    loading = false;
    mediaList: any[];
    list = {
        shopTotal: '',
        userTotal: '',
        orderTotal: '',
        newShop: '',
        newUser: '',
        newOrder: '',

    };

    constructor(
        private request: RequestService,
        private fullnameService: FullnameService,
        private activatedRoute: ActivatedRoute,
        private router: Router,
        private confirm: ConfirmService,
        private toast: ToastService,
        public global: GlobalService,
    ) {
        this.mediaList = [];
    }

    ngOnInit() {
        this.activatedRoute.url
            .pipe(skipWhile(() => this.router.url !== '/manage/account'))
            .subscribe(() => this.loadDatas());
        // this.request.withoutHost().text('https://randomuser.me/api?results=4')
        // .subscribe(res => {
        //     const response = JSON.parse(res);
        //     response.results.forEach(user => {
        //         this.mediaList.push({ avatar: user.picture.thumbnail, nick: user.name.first, email: user.email });
        //     });
        // });
        this.loadDatas();
    }
    loadDatas() {
        // this.loading = true;
        // this.fullnameService.getBanners().subscribe(res => {
        //     this.list = res.datas;
        //     console.log('s', this.list);

        // });
    }
}

